package com.nw.service;

import com.alibaba.fastjson.JSONObject;
import com.nw.common.Result;
import org.bson.Document;

import java.util.List;
import java.util.Map;

public interface MongoService {
    long queryCount(String collectionName, Map<String, Object> query);
     void  add(String collectionName, Map<String, Object> map);
     void addBatch(String collectionName, List<Map<String, Object>> list);
    void update(String collectionName, Map<String, Object> query, Map<String, Object> map);
    void delete(String collectionName, Map<String, Object> query);
    List<Document> query(String collectionName, Map<String, Object> query, Map<String, Object> sort, int skip, int limit);
    Document queryOne(String collectionName, Map<String, Object> query);
    List<Document> queryFields(String collectionName, Map<String, Object> query, Map<String, Object> sort, int skip, int limit);

    boolean validateToken(Object token);
    boolean validateUserNameForRepeat(String user_name);
    Result validateParam(JSONObject obj);
    Result login(JSONObject obj);
    long loginOut(String token);
    Result update(JSONObject obj);
}
